Skip to content

Incompletely allow overloaded call from opaque when self type bottoms out in infer #140496

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

compiler-errors
Copy link
Member

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. WG-trait-system-refactor The Rustc Trait System Refactor Initiative (-Znext-solver) labels Apr 30, 2025
@rust-log-analyzer

This comment has been minimized.

bors added a commit to rust-lang-ci/rust that referenced this pull request Apr 30, 2025
[DO NOT MERGE] bootstrap with `-Znext-solver=globally`

A revival of rust-lang#124812.

Current status:

~~`./x.py b --stage 2` passes 🎉~~

`try` builds succeed 🎉 🎉 🎉

~~[top 100 most downloaded crates on crates.io compile](rust-lang#133502 (comment)

[top 1000 most downloaded crates on crates.io compile](rust-lang#133502 (comment))

[first perf run](rust-lang#133502 (comment)) 👻

### in-flight changes

- rust-lang#139587
- rust-lang#140497
- rust-lang#124852, unsure whether I actually want to land this PR for now
- https://github.com/lcnr/rust/tree/opaque-type-method-call
- rust-lang#140260
- rust-lang#140375
- rust-lang#140405
- rust-lang#140496

r? `@ghost`
bors added a commit to rust-lang-ci/rust that referenced this pull request Apr 30, 2025
[DO NOT MERGE] bootstrap with `-Znext-solver=globally`

A revival of rust-lang#124812.

Current status:

~~`./x.py b --stage 2` passes 🎉~~

`try` builds succeed 🎉 🎉 🎉

~~[top 100 most downloaded crates on crates.io compile](rust-lang#133502 (comment)

[top 1000 most downloaded crates on crates.io compile](rust-lang#133502 (comment))

[first perf run](rust-lang#133502 (comment)) 👻

### in-flight changes

- rust-lang#139587
- rust-lang#140497
- rust-lang#124852, unsure whether I actually want to land this PR for now
- https://github.com/lcnr/rust/tree/opaque-type-method-call
- rust-lang#140260
- rust-lang#140375
- rust-lang#140405
- rust-lang#140496

r? `@ghost`
@bors
Copy link
Collaborator

bors commented Apr 30, 2025

☔ The latest upstream changes (presumably #140520) made this pull request unmergeable. Please resolve the merge conflicts.

bors added a commit to rust-lang-ci/rust that referenced this pull request May 1, 2025
[DO NOT MERGE] bootstrap with `-Znext-solver=globally`

A revival of rust-lang#124812.

Current status:

~~`./x.py b --stage 2` passes 🎉~~

`try` builds succeed 🎉 🎉 🎉

[first perf run](rust-lang#133502 (comment)) 👻

### crater

This does not detect hangs or memory issues.

| date | #crates | #regressions |
| ---- | ------- | ------------ |
| 2025.04.11 | 100 | 2 |
| 2025.04.11 | 1000 | 27 |
| 2025.04.17 | 10000 | 456 |
| 2025.04.18 | 10000 | 437 |
| 2025.04.24 | 10000 | 164 |
| 2025.04.26 | 10000 | 108 |
| 2025.04.28 | 10000 | 91 |
| 2025.05.01 | 10000 | 145 woops |

### in-flight changes

- rust-lang#139587
- rust-lang#140497
- rust-lang#124852, unsure whether I actually want to land this PR for now
- https://github.com/lcnr/rust/tree/opaque-type-method-call
- rust-lang#140260
- rust-lang#140375
- rust-lang#140405
- rust-lang#140496

r? `@ghost`
bors added a commit to rust-lang-ci/rust that referenced this pull request May 3, 2025
[DO NOT MERGE] bootstrap with `-Znext-solver=globally`

A revival of rust-lang#124812.

Current status:

~~`./x.py b --stage 2` passes 🎉~~

`try` builds succeed 🎉 🎉 🎉

[first perf run](rust-lang#133502 (comment)) 👻

### crater

This does not detect hangs or memory issues.

| date | #crates | #regressions |
| ---- | ------- | ------------ |
| 2025.04.11 | 100 | 2 |
| 2025.04.11 | 1000 | 27 |
| 2025.04.17 | 10000 | 456 |
| 2025.04.18 | 10000 | 437 |
| 2025.04.24 | 10000 | 164 |
| 2025.04.26 | 10000 | 108 |
| 2025.04.28 | 10000 | 91 |
| 2025.05.01 | 10000 | 145 woops |
| 2025.05.03 | 624228[^1] |  1585 |

[^1]: a complete crater run

### in-flight changes

- rust-lang#139587
- rust-lang#140497
- rust-lang#124852, unsure whether I actually want to land this PR for now
- https://github.com/lcnr/rust/tree/opaque-type-method-call
- rust-lang#140260
- rust-lang#140375
- rust-lang#140405
- rust-lang#140496

r? `@ghost`
bors added a commit to rust-lang-ci/rust that referenced this pull request May 3, 2025
[DO NOT MERGE] bootstrap with `-Znext-solver=globally`

A revival of rust-lang#124812.

Current status:

~~`./x.py b --stage 2` passes 🎉~~

`try` builds succeed 🎉 🎉 🎉

[first perf run](rust-lang#133502 (comment)) 👻

### crater

This does not detect hangs or memory issues.

| date | #crates | #regressions |
| ---- | ------- | ------------ |
| 2025.04.11 | 100 | 2 |
| 2025.04.11 | 1000 | 27 |
| 2025.04.17 | 10000 | 456 |
| 2025.04.18 | 10000 | 437 |
| 2025.04.24 | 10000 | 164 |
| 2025.04.26 | 10000 | 108 |
| 2025.04.28 | 10000 | 91 |
| 2025.05.01 | 10000 | 145 woops |
| 2025.05.03 | 624228[^1] |  1585 |

[^1]: a complete crater run

### in-flight changes

- rust-lang#139587
- rust-lang#140497
- rust-lang#124852, unsure whether I actually want to land this PR for now
- https://github.com/lcnr/rust/tree/opaque-type-method-call
- rust-lang#140260
- rust-lang#140375
- rust-lang#140405
- rust-lang#140496
- double recursion limit in the new solver

r? `@ghost`
lcnr added 4 commits May 4, 2025 23:47
While still only using them for diagnostics. We could use them for cycle
detection in generalization and it seems desirable to do so in the future.
However, this is unsound with the old trait solver as its cache does not track
these `sub_relations` in any way. We would also need to consider them
when canonicalizing as otherwise instantiating the canonical response may
fail.
@rust-log-analyzer
Copy link
Collaborator

The job x86_64-gnu-llvm-19 failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)
#18 exporting to docker image format
#18 sending tarball 21.0s done
#18 DONE 26.5s
##[endgroup]
Setting extra environment values for docker:  --env ENABLE_GCC_CODEGEN=1 --env GCC_EXEC_PREFIX=/usr/lib/gcc/
[CI_JOB_NAME=x86_64-gnu-llvm-19]
[CI_JOB_NAME=x86_64-gnu-llvm-19]
debug: `DISABLE_CI_RUSTC_IF_INCOMPATIBLE` configured.
---
sccache: Listening on address 127.0.0.1:4226
##[group]Configure the build
configure: processing command line
configure: 
configure: build.configure-args := ['--build=x86_64-unknown-linux-gnu', '--llvm-root=/usr/lib/llvm-19', '--enable-llvm-link-shared', '--set', 'rust.randomize-layout=true', '--set', 'rust.thin-lto-import-instr-limit=10', '--set', 'build.print-step-timings', '--enable-verbose-tests', '--set', 'build.metrics', '--enable-verbose-configure', '--enable-sccache', '--disable-manage-submodules', '--enable-locked-deps', '--enable-cargo-native-static', '--set', 'rust.codegen-units-std=1', '--set', 'dist.compression-profile=balanced', '--dist-compression-formats=xz', '--set', 'rust.lld=false', '--disable-dist-src', '--release-channel=nightly', '--enable-debug-assertions', '--enable-overflow-checks', '--enable-llvm-assertions', '--set', 'rust.verify-llvm-ir', '--set', 'rust.codegen-backends=llvm,cranelift,gcc', '--set', 'llvm.static-libstdcpp', '--set', 'gcc.download-ci-gcc=true', '--enable-new-symbol-mangling']
configure: build.build          := x86_64-unknown-linux-gnu
configure: target.x86_64-unknown-linux-gnu.llvm-config := /usr/lib/llvm-19/bin/llvm-config
configure: llvm.link-shared     := True
configure: rust.randomize-layout := True
configure: rust.thin-lto-import-instr-limit := 10
---
To only update this specific test, also pass `--test-args issues/issue-15965.rs`

error: 1 errors occurred comparing output.
status: exit status: 1
command: env -u RUSTC_LOG_COLOR RUSTC_ICE="0" RUST_BACKTRACE="short" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/tests/ui/issues/issue-15965.rs" "-Zthreads=1" "-Zsimulate-remapped-rust-src-base=/rustc/FAKE_PREFIX" "-Ztranslate-remapped-path-to-local-path=no" "-Z" "ignore-directory-in-diagnostics-source-blocks=/cargo" "-Z" "ignore-directory-in-diagnostics-source-blocks=/checkout/vendor" "--sysroot" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2" "--target=x86_64-unknown-linux-gnu" "--check-cfg" "cfg(test,FALSE)" "--error-format" "json" "--json" "future-incompat" "-Ccodegen-units=1" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zwrite-long-types-to-disk=no" "-Cstrip=debuginfo" "--emit" "metadata" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/issues/issue-15965" "-A" "unused" "-A" "internal_features" "-Crpath" "-Cdebuginfo=0" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers"
stdout: none
--- stderr -------------------------------
error[E0618]: expected function, found `_`
##[error]  --> /checkout/tests/ui/issues/issue-15965.rs:3:9
   |
---
------------------------------------------


---- [ui] tests/ui/unboxed-closures/unboxed-closures-failed-recursive-fn-2.rs stdout ----
Saved the actual stderr to "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/unboxed-closures/unboxed-closures-failed-recursive-fn-2/unboxed-closures-failed-recursive-fn-2.stderr"
diff of stderr:

- error[E0282]: type annotations needed for `Option<_>`
-   --> $DIR/unboxed-closures-failed-recursive-fn-2.rs:8:9
+ error[E0618]: expected function, found `_`
+   --> $DIR/unboxed-closures-failed-recursive-fn-2.rs:17:32
3    |
+ LL |                     Some(c) => {
+    |                          - `c` has type `_`
+ LL |                         return c();
+    |                                ^--
+    |                                |
+    |                                call expression requires function
+ 
+ error[E0308]: mismatched types
+   --> $DIR/unboxed-closures-failed-recursive-fn-2.rs:25:20
+    |
4 LL |     let mut closure0 = None;
-    |         ^^^^^^^^^^^^
+    |                        ---- expected due to this value
6 ...
- LL |                         return c();
-    |                                --- type must be known at this point
+ LL |         closure0 = || vec;
+    |                    ^^^^^^ expected `Option<_>`, found closure
9    |
- help: consider giving `closure0` an explicit type, where the placeholders `_` are specified
+    = note: expected enum `Option<_>`
+            found closure `{closure@$DIR/unboxed-closures-failed-recursive-fn-2.rs:25:20: 25:22}`
+ help: try wrapping the expression in `Some`
11    |
- LL |     let mut closure0: Option<T> = None;
-    |                     +++++++++++
+ LL |         closure0 = Some(|| vec);
+    |                    +++++      +
14 
- error: aborting due to 1 previous error
+ error: aborting due to 2 previous errors
16 
---

Note: some mismatched output was normalized before being compared
-   --> /checkout/tests/ui/unboxed-closures/unboxed-closures-failed-recursive-fn-2.rs:17:32
-   --> /checkout/tests/ui/unboxed-closures/unboxed-closures-failed-recursive-fn-2.rs:25:20
-            found closure `{closure@/checkout/tests/ui/unboxed-closures/unboxed-closures-failed-recursive-fn-2.rs:25:20: 25:22}`
+ error[E0618]: expected function, found `_`
+   --> $DIR/unboxed-closures-failed-recursive-fn-2.rs:17:32
+ LL |                     Some(c) => {
+    |                          - `c` has type `_`
+ LL |                         return c();
+    |                                ^--
+    |                                |
+    |                                call expression requires function
+ 
+ error[E0308]: mismatched types
+   --> $DIR/unboxed-closures-failed-recursive-fn-2.rs:25:20
+    |
+    |                        ---- expected due to this value
+ LL |         closure0 = || vec;
+    |                    ^^^^^^ expected `Option<_>`, found closure
+    = note: expected enum `Option<_>`
+            found closure `{closure@$DIR/unboxed-closures-failed-recursive-fn-2.rs:25:20: 25:22}`
+ help: try wrapping the expression in `Some`
+ LL |         closure0 = Some(|| vec);
+    |                    +++++      +
+ error: aborting due to 2 previous errors
+ Some errors have detailed explanations: E0308, E0618.
+ For more information about an error, try `rustc --explain E0308`.


The actual stderr differed from the expected stderr.
To update references, rerun the tests and pass the `--bless` flag
To only update this specific test, also pass `--test-args unboxed-closures/unboxed-closures-failed-recursive-fn-2.rs`

error: 1 errors occurred comparing output.
status: exit status: 1
command: env -u RUSTC_LOG_COLOR RUSTC_ICE="0" RUST_BACKTRACE="short" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/tests/ui/unboxed-closures/unboxed-closures-failed-recursive-fn-2.rs" "-Zthreads=1" "-Zsimulate-remapped-rust-src-base=/rustc/FAKE_PREFIX" "-Ztranslate-remapped-path-to-local-path=no" "-Z" "ignore-directory-in-diagnostics-source-blocks=/cargo" "-Z" "ignore-directory-in-diagnostics-source-blocks=/checkout/vendor" "--sysroot" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2" "--target=x86_64-unknown-linux-gnu" "--check-cfg" "cfg(test,FALSE)" "--error-format" "json" "--json" "future-incompat" "-Ccodegen-units=1" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zwrite-long-types-to-disk=no" "-Cstrip=debuginfo" "--emit" "metadata" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/unboxed-closures/unboxed-closures-failed-recursive-fn-2" "-A" "unused" "-A" "internal_features" "-Crpath" "-Cdebuginfo=0" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers"
stdout: none
--- stderr -------------------------------
error[E0618]: expected function, found `_`
##[error]  --> /checkout/tests/ui/unboxed-closures/unboxed-closures-failed-recursive-fn-2.rs:17:32
   |
---
   |
LL |     let mut closure0 = None;
   |                        ---- expected due to this value
...
LL |         closure0 = || vec;
   |                    ^^^^^^ expected `Option<_>`, found closure
   |
   = note: expected enum `Option<_>`
           found closure `{closure@/checkout/tests/ui/unboxed-closures/unboxed-closures-failed-recursive-fn-2.rs:25:20: 25:22}`
help: try wrapping the expression in `Some`
   |
LL |         closure0 = Some(|| vec);
   |                    +++++      +

error: aborting due to 2 previous errors

Some errors have detailed explanations: E0308, E0618.

bors added a commit to rust-lang-ci/rust that referenced this pull request May 5, 2025
[DO NOT MERGE] bootstrap with `-Znext-solver=globally`

A revival of rust-lang#124812.

Current status:

~~`./x.py b --stage 2` passes 🎉~~

`try` builds succeed 🎉 🎉 🎉

[first perf run](rust-lang#133502 (comment)) 👻

### crater

This does not detect hangs or memory issues.

| date | #crates | #regressions |
| ---- | ------- | ------------ |
| 2025.04.11 | 100 | 2 |
| 2025.04.11 | 1000 | 27 |
| 2025.04.17 | 10000 | 456 |
| 2025.04.18 | 10000 | 437 |
| 2025.04.24 | 10000 | 164 |
| 2025.04.26 | 10000 | 108 |
| 2025.04.28 | 10000 | 91 |
| 2025.05.01 | 10000 | 145 woops |
| 2025.05.03 | 624228[^1] |  1585 |

[^1]: a complete crater run

### in-flight changes

- rust-lang#139587
- rust-lang#140497
- rust-lang#124852, unsure whether I actually want to land this PR for now
- https://github.com/lcnr/rust/tree/opaque-type-method-call
- rust-lang#140260
- rust-lang#140375
- rust-lang#140405
- rust-lang#140496
- double recursion limit in the new solver

r? `@ghost`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. WG-trait-system-refactor The Rustc Trait System Refactor Initiative (-Znext-solver)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

calling impl Fn in defining scope
5 participants